const GenderSet = [
  {
    id: '0',
    name: '全部',
    color: 'green',
    options: true,
  },
  {
    id: '1',
    name: '男性',
    color: 'blue',
    options: true,
  },
  {
    id: '2',
    name: '女性',
    color: 'orange',
    options: true,
  },
];

export const GenderOptions = GenderSet.filter(o => o.options).map(o => ({
  id: o.id,
  name: o.name,
  color: o.color,
} ) );

export const genderEnumValue = () =>
{ 
  const obj = {};
  GenderOptions.forEach( o => obj[o.id] = { ...o,label: o.name, color:o.color } );
  return obj;
}


export const GenderDefault = GenderSet[0];

export const GenderParse = {
  parse: (code: string) => {
    const obj = GenderSet.find(o => o.id === code) || GenderSet[0];
    return { ...obj };
  },
};
